home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
TBROWS.ZIP
/
TTBR9.PRG
< prev
Wrap
Text File
|
1990-10-22
|
4KB
|
181 lines
/*****
*
* TTBR9.PRG
* Nineth example for TBROWSE class using a database file
*
* 22 October 90
* Luiz Quintela - Nantucket Corp
*
* Clipper ttbr9 /N/W/A/B
* RTLINK FILE ttbr9 PLL base50
*
*/
// Include Header Files
#include "inkey.ch"
#include "setcurs.ch"
MEMVAR GetList
FUNCTION Main()
LOCAL b, column, nKey, aColors, nCnt, aLowHi
SET SCOREBOARD OFF
SET DATE BRITISH
SET CONFIRM ON
READEXIT(.T.)
USE test INDEX test NEW
// Turn cursor off
SETCURSOR(SC_NONE)
SETCOLOR( "BG/B" ); CLS
b := TBrowseDB( 2, 2, 20, 48)
b:colorSpec := "BG/B,GR+/R,W/N,N,GR+/W,N/B,R+/B,GR+/B"
b:colSep := " │ "
b:headSep := "═╤═"
b:footSep := "═══"
// TBColumn objects
// Due to the fact that ahead in this example
// we will edit the field, we need to assign a get-set
// block to the object
// In Clipper's old times it was a regular practice
// use of macro operator
// But now, you can use FIELDBLOCK()
// thus avoiding the overhead in size and speed
// Be aware of this:
// Do not use FIELDBLOCK("alias->field")
// Use always FIELDBLOCK("field")
// FIELDBLOCK() assumes you are using a field in the current
// work area
// If you need to use a field in another area use FIELDWBLOCK()
//
column := TBColumnNew( "Field 1", FIELDBLOCK("test->fld1") )
column:footing := "First"
b:addColumn( column )
column := TBColumnNew( "Field 2", FIELDBLOCK("fld2") )
b:addColumn( column )
column := TBColumnNew( "Field 3", FIELDBLOCK("fld3") )
b:addColumn( column )
column := TBColumnNew( "Field 4", FIELDBLOCK("fld4") )
b:addColumn( column )
column := TBColumnNew( "Field 5", FIELDBLOCK("fld5") )
column:footing := "Last"
b:addColumn( column )
// Freeze one column
b:freeze := 1
WHILE .T.
IF ( b:colPos <= 1 )
b:colPos := b:freeze + 1
ENDIF
// Stabilization
WHILE ( !b:stabilize() )
nKey := InKey()
IF ( nKey != 0 )
EXIT // abort if a key is waiting
ENDIF
END
IF ( b:stable )
IF ( b:hitTop .OR. b:hitBottom )
TONE(87.3,1)
TONE(40,3.5)
ENDIF
nKey := INKEY(0)
ENDIF
// Process key
IF ( nKey == K_DOWN )
b:down()
ELSEIF ( nKey == K_UP )
b:up()
ELSEIF ( nKey == K_PGDN )
b:pageDown()
ELSEIF ( nKey == K_PGUP )
b:pageUp()
ELSEIF ( nKey == K_CTRL_PGUP )
b:goTop()
ELSEIF ( nKey == K_CTRL_PGDN )
b:goBottom()
ELSEIF ( nKey == K_RIGHT )
b:right()
ELSEIF ( nKey == K_LEFT )
b:left()
ELSEIF ( nKey == K_HOME )
b:home()
ELSEIF ( nKey == K_END )
b:end()
ELSEIF ( nKey == K_CTRL_LEFT )
b:panLeft()
ELSEIF ( nKey == K_CTRL_RIGHT )
b:panRight()
ELSEIF ( nKey == K_CTRL_HOME )
b:panHome()
ELSEIF ( nKey == K_CTRL_END )
b:panEnd()
ELSEIF ( nKey == K_ESC )
CLS; SETCURSOR(SC_NORMAL); QUIT
ELSEIF ( nKey == K_ENTER )
DoGet( b )
ENDIF
END
FUNCTION DoGet( b )
LOCAL nCursSave
LOCAL column, get, nKey
nCursSave := SETCURSOR(SC_NORMAL)
// make sure browse is stable
WHILE ( !b:stabilize() ); END
// get column object from browse
column := b:getColumn( b:colPos )
// create a corresponding GET
get := GetNew( ROW(), COL(), column:block, column:heading,, b:colorSpec)
//read it
READMODAL( {get} )
// force redisplay of current row
b:refreshCurrent()
// check exit key */
nKey := LASTKEY()
IF ( nKey == K_UP .OR. nKey == K_DOWN .OR. ;
nKey == K_PGUP .OR. nKey == K_PGDN )
KEYBOARD CHR( nKey )
ENDIF
SETCURSOR(SC_NONE)
RETURN NIL
/* EOF - TBBR9.PRG */